import {getStorageSync, redirectTo, setStorageSync, useLoad} from '@tarojs/taro'
import PageLoading from '@/components/PageLoading'

import './index.scss'

export default function Index () {
  useLoad(() => {
    console.log('Page loaded.')
    const token = getStorageSync('token')

    console.log(token,"当前的splash用户token")
    if(!token){
      // 需要登录但未登录，跳转到登录页
      redirectTo({ url: '/pages/login/index' })
    }else{
      redirectTo({ url: '/pages/index/index' })
    }
  })

  return <PageLoading />
}
